package com.ewili.x.special.dao.inter;

import com.ewili.x.special.entity.HyRank;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;

public interface HyRankDao extends JpaRepository<HyRank, Long> {

    HyRank findByStockCodeAndDate(String stockCode, Date date);

    @Query(value = "select count(1) from hy_rank where pe_rank like '%低%' and pb_rank like '%低%' and total_value_rank like '%低%' and roe_rank like '%高%' and code=?1 and date = ?2\n" +
            "\n", nativeQuery = true)
    double lowValueHighGrowth(String code, Date date);

    @Query(value = "select count(1) from hy_rank where (pe_rank like '%高%' or pe_rank like '%0%') and (pb_rank like '%高%' or pb_rank like '%0%') and code=?1 and date = ?2\n" +
            "\n", nativeQuery = true)
    double highValueLowGrowth(String code, Date date);
}
